<?php
    if (empty($_GET['user'])) return;
    $user = htmlentities($_GET['user']);
    
    if (!file_exists("tweets/$user.json")) return;
    
    $data = file_get_contents('tweets/' . $user . '.json');
    $json = json_decode($data, true);

    $data = array();
    foreach($json as $item) {
        $data[] = array(
            "time" => $item['created_at'],
            "text" => $item['text']
        );
    }
?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="http://static.haykranen.nl/common/style.css" />
    <style type="text/css">
        table {
        	font: 11px/24px Verdana, Arial, Helvetica, sans-serif;
        	border-collapse: collapse;
        	width: 100%;
        }
        
        th {
        	padding: 0 0.5em;
        	text-align: left;
        }
        
        tr.yellow td {
        	border-top: 1px solid #FB7A31;
        	border-bottom: 1px solid #FB7A31;
        	background: #FFC;
        }
        
        td {
        	border-bottom: 1px solid #CCC;
        	padding: 0 0.5em;
        }
        
        td+td {
        	border-left: 1px solid #CCC;
        	text-align: center;
        }
    </style>    
</head>
<body>
<table>
    <thead>
        <th>Time</th>
        <th>Text</th>
    </thead>
    <?php foreach($data as $item) : ?>
    <tr>
        <td><?php echo $item['time']; ?></td>
        <td><?php echo $item['text']; ?></td>
    </tr>
    <?php endforeach; ?>
</table>
</body>
</html>